package org.sith.taskrunner.servlets;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Enumeration;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class ExperimentsServlet extends HttpServlet {

	private static final String CONTENT_TYPE = "text/html;charset=UTF-8";

	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		response.setContentType(CONTENT_TYPE);
		String host = request.getHeader("host");
		String userAgent = request.getHeader("user-agent");
		String accept = request.getHeader("accept");
		String acceptLanguage = request.getHeader("accept-language");
		String acceptEncoding = request.getHeader("accept-encoding");
		String acceptCharset = request.getHeader("accept-charset");
		String keepAlive = request.getHeader("keep-alive");
		String connection = request.getHeader("connection");
		String cookie = request.getHeader("cookie");
		PrintWriter out = response.getWriter();
		try{
			out.println("<html>");
			out.println("<head>");
			out.println("<title>Experiments</title>");
			out.println("<body>");			
			out.println("<h1>Host - "+host+"</h1>");
			out.println("<h1>User Agent - "+userAgent+"</h1>");
			out.println("<h1>Acept - "+accept+"</h1>");
			out.println("<h1>Acept-language - "+acceptLanguage+"</h1>");
			out.println("<h1>Accept-Encoding - "+acceptEncoding+"</h1>");
			out.println("<h1>Accept-Charset - "+acceptCharset+"</h1>");
			out.println("<h1>Keep-Alive - "+keepAlive+"</h1>");
			out.println("<h1>Connection - "+connection+"</h1>");
			out.println("<h1>Cookie - "+cookie+"</h1>");
			out.println("</body>");
			out.println("</head>");
			out.println("</html>");
		}finally{
			out.close();
		}

	}

}
